package yawning.mew.bear;

import yawning.mew.sim.SimulationAction;

public class SkullBashAction implements SimulationAction {
	private BearThreatSimulator mState;
	public double mCooldownExpireTime;

	SkullBashAction(BearThreatSimulator state) {
		mState = state;
	}

	public double perform() {
		int cost = mState.mModel.skullBashCost;

		if (mCooldownExpireTime > mState.mSimEngine.getSimTime() || !mState.hasRage(cost)) return SimulationAction.ACTION_FAIL;

		mCooldownExpireTime = mState.mSimEngine.getSimTime() + mState.mModel.skullBashCDDuration;

		if (mState.mIsLogging) mState.mLog.log("Skull Bash\n");

		// Per 4.1 PTR patch notes, all interrupts are reliable.
		mNrSkullBashHit++;

		mState.mActiveTargetData.getSimulationTarget().getTargetCastEv().interrupt();

		mState.onRageLoss(cost, false);

		return 0.0f;
	}

	int mNrSkullBashHit = 0;
	int mNrSkullBashMiss = 0;
}
